package com.wsc.wscbirthdaykeeper.persistence.dao;

import java.sql.SQLException;
import java.util.List;

import com.j256.ormlite.dao.Dao;
import com.wsc.wscbirthdaykeeper.model.entity.Person;

@SuppressWarnings("rawtypes")
public class PersonDAO extends GenericDao {

	public static List<Person> queryForAll() throws SQLException, Exception {
		Dao<Person, Long> dao = getPersonDao();
		return dao.queryForAll();
	}

	public static Person create(Person person) throws SQLException, Exception {
		Dao<Person, Long> dao = getPersonDao();
		dao.create(person);
		return person;
	}

	public static int update(Person person) throws SQLException, Exception {
		Dao<Person, Long> dao = getPersonDao();
		return dao.update(person);
	}

	public static int delete(Person person) throws SQLException, Exception {
		Dao<Person, Long> dao = getPersonDao();
		return dao.delete(person);
	}
}
